package versionControl.aspectj.library;


public abstract aspect Rollback {
	/*
	 * Expose an abstract rollback(Version) pointcut to delete the latest 
	 * version and use the previous version as the most updated one. 
	 * (Delete the last change made)
	 * 
	 *  This operation can only be performed on the latest version
	 */
	public abstract pointcut rollback(Versioned obj);
	
	before(Versioned obj):rollback(obj)  
	{	
		if (obj.getVersionID() == obj.getLatestVersionID())
		{
			obj.deleteVersion(obj.getLatestVersionID());
			obj.setVersionID(obj.getLatestVersionID());
		}
	}	
}